package ttu.takeshi.tasks.db;

import java.io.Serializable;
import java.sql.SQLException;

import ttu.eclass.DBServer.MoodleDatabase;

public class LoginQueryTask extends QueryTask implements Serializable{
	private static final long serialVersionUID = -6387112702400566892L;
	String username="";
	String password="";
	public LoginQueryTask(String username){
		this.username = username;
	}
	public void setUsername(String username) {
		this.username = username;
	}
	public String getPassword() {
		return password;
	}
	@Override
	public void run() {
		querySQL = "SELECT * FROM mdl_user where username=\'"+username+"\'";
		MoodleDatabase md = new MoodleDatabase();
		resultSet = md.query(querySQL);
		try {
			this.password = resultSet.getString("password");
		} catch (SQLException e) {
			e.printStackTrace();
		}
	}
	
}
